package com.ruihu.admin.module.business.task.converter;

import cn.hutool.core.collection.CollectionUtil;
import com.ruihu.admin.module.business.task.domain.dto.TaskNodeInstDTO;
import com.ruihu.admin.module.business.task.domain.entity.TaskNodeInstEntity;
import com.ruihu.admin.module.business.task.domain.vo.TaskNodeInstVO;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class TaskNodeInstList {

    public static List<TaskNodeInstVO> convertEntityToTaskNodeInstVOList(List<TaskNodeInstEntity> taskNodeInstEntityList) {
        if (CollectionUtil.isEmpty(taskNodeInstEntityList)) {
            return new ArrayList<>(0);
        }

        List<TaskNodeInstVO> voList = new ArrayList<>(taskNodeInstEntityList.size());
        taskNodeInstEntityList.forEach(e -> voList.add(TaskNodeInstVO.convertToTaskNodeInstVO(e)));

        return voList;
    }

    public static List<TaskNodeInstVO> convertDTOToTaskNodeInstVOList(List<TaskNodeInstDTO> taskNodeInstDTOList) {
        if (CollectionUtil.isEmpty(taskNodeInstDTOList)) {
            return new ArrayList<>(0);
        }

        List<TaskNodeInstVO> voList = new ArrayList<>(taskNodeInstDTOList.size());
        taskNodeInstDTOList.forEach(e -> voList.add(TaskNodeInstVO.convertToTaskNodeInstVO(e)));

        return voList;
    }

}
